package com.kenliang.javase.concurrent.thread;

/**
 * @author KenLiang
 * @description:
 * @date Created in 4:33 PM 2019/3/15.
 */
public class ThreadState {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new MyThread1("t1",100);
        thread.start();

        thread.join();
        System.out.println(thread.getState());

        thread.interrupt();

        System.out.println(thread.isInterrupted());
    }
}

class MyThread1 extends Thread{
    private String threadName;
    private int times;

    public MyThread1(String threadName, int times){
        this.threadName = threadName;
        this.times = times;
    }
    @Override
    public void run(){
        for(int i = 0 ; i < times; i++){
            System.out.println(threadName + ":-->" + i);
        }
    }
}
